<template>
  <div class="ablum-card-wrap">
    <img
      class="ablum-card-wrap-bg"
      :src="
        `${album.coverImgUrl}?imageView&thumbnail=50y50&quality=15&tostatic=0`
      "
    />
    <div class="card-content-box flex">
      <div class="poster">
        <div class="tip">歌单</div>
        <div class="count">{{ playCount }}</div>
        <img
          class="img"
          :src="
            `${album.coverImgUrl}?imageView&thumbnail=250y250&quality=75&tostatic=0`
          "
          alt=""
        />
      </div>
      <div class="info">
        <div class="title">{{ album.name }}</div>
        <div class="auth flex-middle">
          <img
            class="avatar"
            :src="
              `${album.creator.avatarUrl}?imageView&thumbnail=50y50&quality=15&tostatic=0`
            "
            alt=""
          />
          <div class="name">{{ album.creator.nickname }}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import { computed, defineComponent, PropType } from "vue";
import { formatNumber } from "@/utils/utils";

export default defineComponent({
  props: {
    album: Object as PropType<Record<string, any>>,
  },
  setup(props) {
    const playCount = computed(() => {
      return props.album ? formatNumber(props.album.playCount) : "";
    });

    return {
      playCount,
    };
  },
});
</script>

<style lang="scss" scoped>
.ablum-card-wrap {
  // height: 300px;
  overflow: hidden;
  position: relative;
  &::after {
    content: "";
    display: block;
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.2);
    z-index: -1;
  }
  .ablum-card-wrap-bg {
    display: block;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    transform: scale(1.5);
    filter: blur(40px);
    z-index: -1;
  }
  .card-content-box {
    padding: 60px 30px;
    .poster {
      position: relative;
      width: 252px;
      height: 252px;
      flex: 0 0 252px;
      .img {
        display: block;
        width: 100%;
        height: 100%;
      }
      .tip {
        position: absolute;
        z-index: 3;
        top: 20px;
        left: 0;
        padding: 0 16px;
        height: 34px;
        color: #fff;
        font-size: 18px;
        text-align: center;
        line-height: 34px;
        background-color: rgba(217, 48, 48, 0.8);
        border-top-right-radius: 34px;
        border-bottom-right-radius: 34px;
      }
      .count {
        position: absolute;
        right: 4px;
        top: 0;
        z-index: 3;
        padding-left: 30px;
        color: #fff;
        font-size: 24px;
        background-position: 0;
        background-repeat: no-repeat;
        background-size: 22px 20px;
        text-shadow: 2px 0 0 rgba(0, 0, 0, 0.15);
      }
    }
    .info {
      padding-left: 35px;
      .title {
        color: #fff;
        font-size: 34px;
        line-height: 1.3;
      }
      .auth {
        color: hsla(0, 0%, 100%, 0.7);
        margin-top: 40px;
        .avatar {
          display: block;
          width: 60px;
          height: 60px;
          border-radius: 30px;
          margin-right: 10px;
        }
      }
    }
  }
}
</style>
